|
|
|
|
|
|
|
The DBEngine Object Collections |
|
|
|
|
|
|
|
|
The DBEngine object contains three different object collections. Each of these collections in turn contains other data-access objects. To put it another way, the DBEngine is the top level of the DAO hierarchy, and it contains the following collections: |
|
|
|
|
|
|
|
|
· Workspaces: A collection of all the defined Workspace objects. The next section of this chapter covers Workspace objects. The Workspace collection is the default collection for the DBEngine object. |
|
|
|
|
|
|
|
|
· Errors: A collection of the most recent database-related errors encountered in this session. Error objects are covered later in this chapter. |
|
|
|
|
|
|
|
|
· Properties: A collection of all the properties of the DBEngine object. |
|
|
|
|
|
|
|
|
The DBEngine Object Properties |
|
|
|
|
|
|
|
|
Like all Visual Basic objects, you can list the properties of the object by accessing the Propertiescollection. Let's write a short bit of code to list (enumerate) all the properties of the DBEngine data access object. |
|
|
|
|
|
|
|
|
Before coding the DBEngine routines, you need to add a support routine to your form. This routine makes it easier to read the output of the rest of the routines in this chapter. Create a new function called ShowType and enter the code from Listing 9.1. |
|
|
|
|
|
|
|
|
Listing 9.1. Creating the ShowType support routine. |
|
|
|
|
|
|
|
|
Public Function ShowType(varTypeCode As Variant) As String
'
' return friendly name of variable type
'
Dim strReturn As String
'
Select Case varTypeCode
Case vbEmpty
strReturn = "Empty"
Case vbNull
strReturn = "Null"
Case vbInteger
strReturn = "Integer"
Case vbLong
strReturn = "Long"
Case vbSingle
strReturn = "Single"
Case vbDouble
strReturn = "Double"
Case vbCurrency
strReturn = "Currency" |
|
|
|
|
|